package com.geekaca.exam;

import java.util.ArrayList;
import java.util.Random;

public class Test6_randomNum {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        Random random =new Random();
        for (int i = 0; i < 50; i++) {
            while (true){
                int num = random.nextInt(10000);
                if (!arrayList.contains(num)){
                    arrayList.add(num);
                    break;
                }
            }
        }
        System.out.println(arrayList.toString());
    }
}
